<?php

namespace App\Helpers;

class ApiHelper
{
    /**
     * api统一资源返回
     *
     * @param $code
     * @param $msg
     * @param string $data
     * @return \Illuminate\Http\JsonResponse
     */
    public static function api_return($code, $msg, $data = ""){
        return response()->json(['code' => $code, 'msg' => $msg, 'data' => $data]);
    }

    /**
     * 错误得请求方法
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public static function wrong_method(){
        return self::api_return(405, '请求方法错误');
    }

}
